package com.chaos.system.service.client;

import com.chaos.framework.model.dto.result.list.ListResult;
import com.chaos.framework.starter.base.BaseController;
import com.chaos.system.api.data.RbacUserData;
import com.chaos.system.api.feign.RbacUserFeign;
import com.chaos.system.service.RbacUserRoleService;
import com.chaos.system.service.RbacUserService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * @author Jacky.Cui
 * @since 2024-11-13
 */
@RestController
@RequiredArgsConstructor
@Slf4j
@Hidden
public class RbacUserClient extends BaseController implements RbacUserFeign {

    private final RbacUserService rbacUserService;
    private final RbacUserRoleService rbacUserRoleService;


    public ListResult<RbacUserData> list(RbacUserData data) {
        return listResult(rbacUserService.selectByData(data));
    }


    @Override
    public Set<Long> selectRolesByUserId(RbacUserData queryData) {
        return rbacUserRoleService.selectRolesByUserId(queryData.getId(), queryData.getTenantId());
    }

    public void initAdminPermission() {
        log.info("[框架]11111111...");
    }


}

